{include file="public/header" /}
<body>
<style>
    .cion{
        display: inline-block;
        width: 120px;
    }
</style>
<div class="page-container">
    <form  method="get" action="">
        <div class="text-c">
        </div>
    </form>

    <div class="cl pd-5 bg-1 bk-gray mt-20">
         <span class="l">
            <a href="javascript:;" onclick="layopen('新增','{:url('goodEdit')}',800,600)" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i>新增</a>
        </span>
        <span class="r">共有数据：<strong>{$list->total()}</strong> 条</span> </div>
    <table class="table table-border table-bordered table-hover table-bg">
        <thead>
            <tr>
                <th scope="col" colspan="12">商品列表</th>
            </tr>
            <tr class="text-c">
                <th width="50">标识</th>
                <th width="50">产品标识</th>
                <th width="50">套餐标识</th>
                <th width="80">金额</th>
                <th width="150">图片地址</th>
                <th width="60">操作</th>
            </tr>
        </thead>
        <tbody>
            {foreach $list as $v}
            <tr class="text-c">
                <td class="text-l">{$v.id}</td>
                <td class="text-l">{$v.good_id}</td>
                <td class="text-l">{$v.plan}</td>
                <td class="text-l">{$v.money}</td>
                <td class="text-l">{$v.img}</td>
                <td>
                    <a class="btn-link" title="编辑" href="javascript:;" onclick="layopen('编辑','{:url('goodEdit',['id'=>$v.id])}')">编辑</a>
                    <a class="btn-link" title="编辑" href="javascript:;" onclick="del({$v.id})">删除</a>
                </td>
            </tr>
            {/foreach}
        </tbody>
    </table>
    <div class="page">
        {$list->render()|raw}
    </div>
</div>

{include file="public/footer" /}

<script type="text/javascript">
function del(id){
    var info = '确认要删除么？';
    layer.confirm(info,function(index){
        $.ajax({
            type: 'POST',
            url: "goodDel?id="+id,
            data: {id:id},
            dataType: 'json',
            success: function(data){
                if(data.status == 'y'){
                    layer.msg("操作成功",{icon:1,time:1000,shade: [0.3, '#000']},function(){
                        location.replace(location.href);
                    });
                }else{
                    layer.msg(data.info,{icon:2,time:1000,shade: [0.3, '#000']});
                }
            },
            error:function(data) {
                console.log(data.msg);
            },
        });
    });
}

</script>